home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mgr / mgrdemos.zoo / demo / sh / loadfont < prev    next >
Encoding:
Text File  |  1989-05-30  |  1.4 KB  |  77 lines

  1. #!/bin/sh
  2. #                        Copyright (c) 1988 Bellcore
  3. #                            All Rights Reserved
  4. #       Permission is granted to copy or use this program, EXCEPT that it
  5. #       may not be sold for profit, the copyright notice must be reproduced
  6. #       on copies, and credit should be given to Bellcore where it is due.
  7. #       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  8.  
  9. #    $Header: loadfont,v 4.1 88/06/21 14:01:31 bianchi Exp $
  10. #    $Source: /tmp/mgrsrc/demo/sh/RCS/loadfont,v $
  11.  
  12. #    load a font by name into a give position
  13.  
  14. usage="Usage:  `basename $0` [ -c ] font-name font-number
  15. Load the given font-name into the given font number
  16. -c    Make the given font the current font.
  17. "
  18.  
  19. ESC=
  20.  
  21. if /bin/test $TERM != mgr
  22. then
  23.     echo "$0 only works on mgr terminals"
  24.     exit 1
  25. fi
  26.  
  27. trap 'exit' 1 2 15
  28. trap 'stty echo' 0
  29.  
  30. stty -echo
  31.  
  32. current=
  33. while [ -n "$1" ]
  34. do
  35.     case $1 in
  36.     -c )
  37.         current=yes
  38.         ;;
  39.     -* )
  40.         echo >&2 "$0:  Illegal option argument.  '$1'"
  41.         echo >&2 "${usage}"
  42.         exit 255
  43.         ;;
  44.     * )
  45.         break
  46.     esac
  47.     shift
  48. done
  49.  
  50. if [ $# -lt 2 ]
  51. then
  52.     echo >&2 "${usage}"
  53.     exit 255
  54. fi
  55.  
  56. fontname=$1
  57. shift
  58.  
  59. fontnumber=$1
  60.  
  61. case "${fontnumber}" in
  62. [1-9] | [1-9][0-9] )
  63.     ;;
  64. * )
  65.     echo >&2 "$0:  font number '${fontnumber}' invalid.  Must be between
  66.     1 through 99."
  67.     echo >&2 "${usage}"
  68.     exit 1
  69. esac
  70.  
  71. len=`expr length ${fontname}`
  72. echo "${ESC}${fontnumber},${len}F${fontname}"
  73. if [ "${current}" = yes ]
  74. then
  75.     echo "${ESC}${fontnumber}F"
  76. fi
  77.